import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.io.StringReader;

import HillClimbing.HillClimbing;
import HillClimbing.HillClimbingParameter;
import HillClimbing.HillClimbing.HillClimbingFunction;
import HillClimbing.HillClimbing.IPropertiesObj;


public class climber {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
//		final ProcessBuilder bld = new ProcessBuilder("java"," -jar ex.jar");
//		bld.directory(new File("G:\\HW\\CHG\\"));
		// TODO Auto-generated method stub
		HillClimbingFunction func =  new HillClimbingFunction() {

			@Override
			public double getScore(IPropertiesObj props) {
//				try {
//					Process p = bld.start();
//					p.waitFor();
//			        File score_file = new File("G:\\HW\\CHG\\score.txt");
//			        FileReader reader;
//			        BufferedReader textReader;
//					try
//					{
//						reader = new FileReader(score_file);
//						textReader = new BufferedReader(reader);
//						double value = Double.parseDouble(textReader.readLine());
//						textReader.close();
//						reader.close();
//						return -value;
//					} 
//					catch (IOException e)
//					{
//						// TODO Auto-generated catch block
//						e.printStackTrace();
//					}
//				} catch (IOException e) {
//					// TODO Auto-generated catch block
//					e.printStackTrace();
//				} catch (InterruptedException e) {
//					// TODO Auto-generated catch block
//					e.printStackTrace();
//				}
//				// TODO Auto-generated method stub
				    PropertiesObj.setPropertiesObject((PropertiesObj)props);
					return tester.execute_main(new String[0]);
				}
//			}
		};
		HillClimbingParameter p = new HillClimbingParameter(80.0, 250.0, 3.0);
		IPropertiesObj props = PropertiesObj.GetPropertiesObject();
		HillClimbing hc = new HillClimbing( func, new HillClimbingParameter[] { p }, props );
		hc.startHillClimbingRandomStarts(100);
	}
}
